import request from './request'

export interface ProductCategoryItem {
  id: number
  name: string
  created_at?: string
}

export function getCategoryList(params?: any) {
  return request<{ total: number; list: ProductCategoryItem[] }>({
    url: '/product-category',
    method: 'get',
    params
  })
}

export function createCategory(data: any) {
  return request({
    url: '/product-category',
    method: 'post',
    data
  })
}

export function updateCategory(id: number, data: any) {
  return request({
    url: `/product-category/${id}`,
    method: 'put',
    data
  })
}

export function deleteCategory(id: number) {
  return request({
    url: `/product-category/${id}`,
    method: 'delete'
  })
}
